package com.lb.activity.service;


import com.lb.activity.po.WebArticleComment;
import com.lb.activity.service.hystrix.TextServiceHystrix;
import com.lb.activity.util.ResultUtil;
import com.lb.activity.vo.ArticleVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "web-service",fallback = TextServiceHystrix.class)
public interface TextService {

    /**
     * 调用了service-web 服务的“/texts”接口,获取文章数据
     *
     * @param page
     * @return
     */
    @GetMapping(value = "rest/texts")
    Map<String, Object> restTexts(@RequestParam(value = "page") Integer page);

    @GetMapping("show/{id}")
    ArticleVo showData(@PathVariable("id") Long id);

    @GetMapping("sync/data")
    void syncData();

    @GetMapping("webArticles")
    List<ArticleVo> arts();

    @PostMapping("addComment")
    ResultUtil addComment(@RequestBody WebArticleComment webArticleComment);

    @PostMapping("comments")
    ResultUtil comments(@RequestParam("actId")Long actId);

    @PostMapping("hotCommentAct")
    ResultUtil hotCommentAct();
}
